﻿using Prism.Mvvm;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using LIZTS.TODOS.Common.Models;

namespace LIZTS.TODOS.ViewModels
{
    public class IndexViewModel : BindableBase
    {
        private ObservableCollection<TaskBar> taskBars;
        private ObservableCollection<TodoDto> todos;
        private ObservableCollection<MemoDto> memos;
        public ObservableCollection<TaskBar> TaskBars
        {
            get { return taskBars; }
            set 
            { 
                taskBars = value;
                RaisePropertyChanged();
            }
        }

        public ObservableCollection<TodoDto> Todos
        {
            get { return todos; }
            set
            {
                todos = value;
                RaisePropertyChanged();
            }
        }

        public ObservableCollection<MemoDto> Memos
        {
            get { return memos; }
            set
            {
                memos = value;
                RaisePropertyChanged();
            }
        }
        public IndexViewModel()
        {
            InitTaskBars();
            MockData();
        }

        private void InitTaskBars()
        {
            TaskBars = new ObservableCollection<TaskBar>();
            taskBars.Add(new TaskBar() { Icon = "ClockFast", Content = "9", Target = "", Title = "Summary", Color = "#0097FF" });
            taskBars.Add(new TaskBar() { Icon = "ClockCheck", Content = "9", Target = "", Title = "Completed", Color = "#10B138" });
            taskBars.Add(new TaskBar() { Icon = "ChartDonut", Content = "100%", Target = "", Title = "Completed Rate", Color = "#00B4DF" });
            taskBars.Add(new TaskBar() { Icon = "PlaylistStar", Content = "19", Target = "", Title = "Memo", Color = "#FFA000" });
        }

        private void MockData()
        {
            Todos = new ObservableCollection<TodoDto>();
            Memos = new ObservableCollection<MemoDto>();

            for (int i = 0; i < 10; i++)
            {
                Todos.Add(new TodoDto() { Title = "todo-" + i, Content="in progress ..."});
                Memos.Add(new MemoDto() { Title = "Memo-" + i, Content="password"});
            }
        }
    }
}
